package com.xt.purchasingsystem.controller;


import com.xt.purchasingsystem.dto.SupplierApprovalDto;
import com.xt.purchasingsystem.service.SupplierApprovalService;
import com.xt.purchasingsystem.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 *供应商申请审批管理的所有接口
 * @author yhp
 * @since 2020-05-31
 */
@RestController
@RequestMapping("/supplierApproval")
public class SupplierApprovalController {

    @Autowired
    SupplierApprovalService supplierApprovalService;

    /**
     * 添加供应商申请审批表和供应商申请审批明细的接口
     * @return
     */
    @PostMapping
    public Result saveSupplierApproval(@RequestBody SupplierApprovalDto supplierApprovalDto){
      return   supplierApprovalService.saveSupplierApproval(supplierApprovalDto);
    }
    /**
     * 分页查询所有未审核和未处理的供应商申请及其明细的接口
     * @param currNo
     * @param pageSize
     * @return
     */
    @GetMapping("/{currNo}/{pageSize}")
    public Result getAllNoCheckAndNoApply(@PathVariable Integer currNo,@PathVariable Integer pageSize){
      return   supplierApprovalService.getAllNoCheckAndNoApply(currNo,pageSize);
    }

    /**
     * 审核供应商申请及其明细的接口
     * @param supplierApprovalDto
     * @return
     */
    @PutMapping
    public Result checkSupplierApproval(@RequestBody SupplierApprovalDto supplierApprovalDto){
        return   supplierApprovalService.checkSupplierApproval(supplierApprovalDto);
    }
}

